package cn.ecnu.common;


public enum Constant {

    // 如果有需要继续添加即可
    OK(0, "success"),
    NORMAL(300, "普通异常如下"),
    SERVLET_ERROR(301, "Servlet异常如下"),
    ERROR(500, "未知错误, 请联系管理员解决"),

    ARGUMENT_INVALID(400, "提交参数错误"),
    NO_PERMISSION(401, "权限不足"),
    PERMISSION_ERROR(402, "权限错误"),

    FREQUENT_REQUEST(800, "验证码请求过于频繁"),
    CODE_FAIL(801, "验证码发送失败"),

    TOKEN_MISSING(600, "token不存在或者已经过期"),
    NO_USER(601, "用户不存在"),
    CODE_ERROR(602, "验证码错误"),
    LOGIN_ERROR(610, "密码或者手机号错误"),
    USER_EXISTS(611, "用户已注册"),
    AUTH_CANCEL(612, "用户授权取消"),
    AUTH_ERROR(613, "无法获取授权信息"),
    AUTH_TIMEOUT(614, "授权超时"),
    NOT_BINDING(615, "支付宝未绑定"),
    NO_RESOURCE(700, "资源不存在"),
    DELETE_ERROR(800, "存在子元素, 删除失败");

    private Integer code; // 错误码
    private String msg; // 错误信息

    Constant(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
